#/bin/bash

# This script is used in order to display the running hdwr_svr and fnmd
#   threads from the restricted shell instead of using the ps command.
#   It is invoked without operands and does not detect whether extraneous
#   operands are supplied.

USAGE="Usage:  lsSNM [ -h ]"

# First check for existence of parameters, then check validity
if (( $# == 1 ))
then
    while test -n "$1"
        do
            case $1 in
                -h) echo $USAGE; exit 0;;
                 *) echo $USAGE; exit 1;;
            esac
        done
fi

/bin/ps -fwwwC hdwr_svr
THREADS=`/bin/ps -fwwwC fnmd | /usr/bin/grep fnmd | /usr/bin/wc -l`
echo "There are $THREADS fnmd threads."

grep_results=`/bin/ps -e | /usr/bin/grep fnmd`
if [[ $grep_results != "" ]]
  then
	/bin/ps -fwwwC fnmd
fi
